<template>
  <div class="box">
    <h1>饿了么</h1>
    <div><span class="xuanxiang" @click="fun(index,item.path,item)" v-for="(item,index) in arr" :key="index" :class="{active:num==index}">{{item.text}}</span></div>
    <router-view />
    <!-- <div class="dianpu" v-for="(item,index) in lists" :key="index">
        <div class="top">
          <span>{{item.name}}</span>
          <span>已送达</span>
        </div>
        <div class="jian">
          <span>{{item.innfo1}}</span>
          <span>{{item.innfo2}}</span>
          <span>{{item.innfo3}}</span>
        </div>
        <div class="img">
          <img :src="item.img" alt="">
          <div class="zi">
            <div>{{item.jia}}</div>
            <div>共{{item.num}}件</div>
          </div>
        </div>
        <div class="bot">
          <div>再来一单</div>
        </div>
  </div> -->
   </div>
</template>

<script>
import service from '../../dmh/ulits/request'
import route from '../router/route'
export default {
  data(){
    return{
      num:0,
      arr:[
                {text:"全部",path:"/xz/all"},
                {text:"待消费",path:"/xz/pay"},
                {text:"待评价",path:"/xz/sc"},
                {text:"退款",path:"/xz/re"},
            ],
      // lists:[]      
    }
  },
  methods: {
    fun(index,path,item){
      this.num=index,
      this.$router.push(`${path}`)
      this.$router.push(route).catch(err => {
  console.log('跳转异常：',err)
})
if (this.$router.path !== item.path) {
    this.$router.push({ path:item.path })
  }
    },
    
  },
  //   mounted() {
  //     // 发请求
  //        service({
  //     url: "http://localhost:3000/li",
  //     method: "get",
  //   }).then((res) => {
  //     console.log(res.data)
  //     this.lists = res.data;
  //   });
  // }
}
</script>

<style scoped>
* {
  margin: 0;
  padding: 0;
}
.box {
  width: 100%;
  height: 100%;
  background-color: rgba(223, 242, 242, 0.865);
}
h1 {
  text-align: center;
  font-size: 24px;
  height: 50px;
  line-height: 50px;
}
.xuanxiang{
  width: 60px;
  height: 40px;
  margin-left: 10px;
  font-size: 20px;
}
.active{
  color: red;
  font-size: 30px;
}
.dianpu{
 width: 96%;
 height: 235px;
 margin-left: 2%;
 background-color: white;
 margin-top: 10px;
}
.dianpu .top{
  display: flex;
  justify-content: space-between;
  /* padding: 8px; */
  box-sizing: border-box;
}
.dianpu .top :nth-child(1){
  color: rgb(12, 0, 0);
  font-size: 20px;
  font-weight: 700;
  line-height: 40px;
  margin-left: 10px;
}
.dianpu .top :nth-child(2){
  margin-right: 20px;
  line-height: 40px;
  color: black;
}
.dianpu .jian span{
  float: left;
  display: flex;
  display: block;
  width: 70px;
  height: 20px;
  line-height: 20px;
  border: 1px solid red;
  text-align: center;
  margin-top: 5px;
}
.dianpu .jian :nth-child(2){
  margin-left: 10px;
}
.dianpu .jian :nth-child(3){
  margin-left: 10px;
}
.dianpu .img{
  margin-top: 40px;
  display: flex;
}
.dianpu .img img{
  width: 125px;
  height: 100px;
}
.dianpu .img .zi{
  width: 41px;
  text-align: center;
  padding: 33px;
  margin-left: 130px;
}
.dianpu .img .zi :nth-child(1){
  font-weight: 700;
  font-size: 18px;
}
.dianpu .img .zi :nth-child(2){
  margin-top: 5px;
}
.dianpu .bot {
  width: 80px;
  height: 30px;
  border: 1px solid red;
  border-radius: 15px;
  margin-left: 260px;
  color: red;
}
.dianpu .bot div{
  width: 80px;
  height: 30px;
  line-height: 30px;
  text-align: center;
}
</style>